import { Tabs,Badge, Button,Alert } from 'antd';
import React from 'react';
import FirstEvaluation from './FirstEvaluation';
import SecondEvaluation from './SecondEvaluation';
import { PageContainer } from '@ant-design/pro-layout';
class index extends React.Component {
    constructor(props) {
        super(props);
        this.state = { 
            tabKey:'1',
            userInfo:JSON.parse(sessionStorage.getItem('userInfo'))
         };
    }
    tabChange=(e)=>{
        this.setState({
            tabKey:e
        })
    }
    tips=()=>{
        return<Alert
        message="权限异常"
        description="您没有权限查看本页面，如有疑问，请联系管理员"
        type="info"
        />
    }
    render() {
        const {tabKey,userInfo} = this.state
        return (
            <PageContainer >
                <Tabs centered onChange={this.tabChange}>
                    <Tabs.TabPane tab={<Badge count={0} offset={[10, -5]}>创新办公室评审</Badge>} key="1">
                        {tabKey==='1'&&userInfo.targs.includes("办公室")?<FirstEvaluation/>:this.tips()}
                    </Tabs.TabPane>
                    <Tabs.TabPane tab={<Badge count={0} offset={[10, -5]}>创新领导小组评审</Badge>} key="2">
                        {tabKey==='2'&&userInfo.targs.includes("小组")?<SecondEvaluation/>:this.tips()}
                    </Tabs.TabPane>
                  
                </Tabs>
            </PageContainer>
        );
    }
}

export default index;